﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BOM.dao
{
    class ExcelNew
    {
        //根据序列号查询数据
        public static DataTable SelectFnumberFiceBillEntry(string fnumber)
        {
            string cmdText = "select PriceBill.*,PriceBillEntry.* from PriceBill,PriceBillEntry where PriceBill.fid = PriceBillEntry.fparentid and fnumber = '" + fnumber + "'";
            DataTable table = DbService.getSQLTable(cmdText, "FiceBillEntryandFiceBill");
            if (table.Rows.Count > 0)
            {
                return table;
            }
            else
            {
                return null;
            }
        }
        //根据fid查 materialgroup表的数据
        public static string SelectfidMaterialgroup(int fid)
        {
            string cmdText = "select fname from materialgroup where fid = " + fid + "";
            DataTable table = DbService.getSQLTable(cmdText, "materialgroup");
            string fname = table.Rows[0]["fname"].ToString();
            return fname;
        }
        //根据fid查material表中的数据
        public static string SelectfidMaterial(int fid)
        {
            string cmdText = "select fname from material where fid = " + fid + "";
            DataTable table = DbService.getSQLTable(cmdText, "material");
            string fname = table.Rows[0]["fname"].ToString();
            return fname;
        }
        //根据fid查询客户的姓名
        public static string Selectfidcustomer(int fid)
        {
            string cmdText = "select fname from customer where fID = " + fid + "";
            DataTable table = DbService.getSQLTable(cmdText, "material");
            string fname = table.Rows[0]["fname"].ToString();
            return fname;
        }

    }
}
